"""Delivery_project URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from .views import *
from django.urls import path
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
# 商家管理
router.register("merchant", MerchantViewSet)
# 菜品分类管理
router.register("disclas", DishesClassifyViewSet)
# 收货地址管理
router.register("address",AddrViewSet)
# 菜品管理
router.register('dishesinfo',DishesModelSet)

# 用户管理
router.register("userinfo", UserInfoAPIView)

urlpatterns = [
    # 发送验证码
    path('sms_code/', SmsAPIView.as_view()),
    # 商家登录
    path("merchant_login/", MerchantAPIView.as_view()),
    # 顾客注册
    path("user_register/", UserRegister.as_view()),
    # 顾客登录
    path("user_login/", UserLoginAPIView.as_view()),
    # 获取商家下的菜品
    path("dishesclass/", MerchantDishesClass.as_view()),
    # 获取菜品分类下的菜
    path("dishes/<int:id>/", DishesAPIView.as_view()),
    # 获取用户信息
    path("infolist/", UserList.as_view()),
    # 七牛云token
    path('qiniu_token/', QiNiuToken.as_view()),
    # 获取所有的店铺
    path('mersheinfo/', MersheInfo.as_view()),
]

urlpatterns += router.urls